//
//  UserInfoTableViewCell.m
//  huien
//
//  Created by yiban on 2017/5/27.
//  Copyright © 2017年 lcb. All rights reserved.
//

#import "UserInfoTableViewCell.h"
@interface UserInfoTableViewCell ()
{
    
}
@property(nonatomic,strong)UIImageView *iconView;
@property(nonatomic,strong)UILabel *phoneLab;
@property(nonatomic,strong)UILabel *btnLab;
@end
@implementation UserInfoTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor =  UIColorFromRGB(0xeff2f2);
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
}
/// 根据数据模型来显示内容
- (void)showInfo:(id)model indexPath:(NSIndexPath *)indexPath
{
    self.data =model;
    self.indexPath=indexPath;
    MemberModel *member = (MemberModel*)model;
    self.iconView.frame =CGRectMake(20, 15, 50, 50);
    [self.iconView lcb_imageWithUrlStr:member.imgUrl placeholder:[UIImage imageNamed:@"user"]];
    self.phoneLab.frame =CGRectMake(self.iconView.frame.origin.x+self.iconView.frame.size.width+10, (80-40)/2, SCREEN_WIDTH, 40);
    self.phoneLab.text = member.userName;
    NSString *title =@"会员管理";
    CGFloat wight = [title widthForFont:self.btnLab.font];
    self.btnLab.frame =CGRectMake(SCREEN_WIDTH-wight-10, (80-40)/2, wight, 40);
    self.btnLab.text = title;
}
+(CGFloat)returnCellHeight
{
    return 80;
}
-(void)dealloc
{
    [LcbLog log:@"UserInfoTableViewCell--------->dealloc"];
}
-(UILabel*)phoneLab
{
    if (!_phoneLab) {
        _phoneLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 20)];
        _phoneLab.font = [UIFont systemFontOfSize:13];
        _phoneLab.textColor = h1color;
        _phoneLab.textAlignment = NSTextAlignmentLeft;
        _phoneLab.backgroundColor = [UIColor clearColor];
        [self addSubview:_phoneLab];
    }
    return _phoneLab;
}
-(UILabel*)btnLab
{
    if (!_btnLab) {
        _btnLab = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-40, 0, self.frame.size.width, 20)];
        _btnLab.font = [UIFont systemFontOfSize:13];
        _btnLab.textColor = h1color;
        _btnLab.textAlignment = NSTextAlignmentLeft;
        _btnLab.backgroundColor = [UIColor clearColor];
        [self addSubview:_btnLab];
    }
    return _btnLab;
}
-(UIImageView*)iconView
{
    if (!_iconView) {
        _iconView =[[UIImageView alloc] initWithFrame:CGRectZero];
        _iconView.layer.cornerRadius = 25;
        [self addSubview:_iconView];
    }
    return _iconView;
}
@end
